<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>PlotClass Developer Guide</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			
	<table class="tutorial-nav-box">
	<tr>
		<td style="width: 30%">
							<a href="../WikiPlot/tutorial_AdminGuide.pkg.html" class="nav-button">Previous</a>
					</td>
		<td style="text-align: center">
					</td>
		<td style="text-align: right; width: 30%">
							<a href="../WikiPlot/tutorial_WikiPlot.pkg.html" class="nav-button">Next</a>
					</td>
	</tr>
	<tr>
		<td style="width: 30%">
							<span class="detail">WikiPlot Administrators Guide</span>
					</td>
		<td style="text-align: center">
					</td>
		<td style="text-align: right; width: 30%">
							<span class="detail">WikiPlot Userguide</span>
					</td>
	</tr>
</table>
	
<div><a name=""></a><div class="ref-title-box">PlotClass Developer Guide<h1 class="ref-title">PlotClass Developer Guide</h1>
		<h2 class="ref-purpose">A developers guide</h2></div>
	<div class="ref-synopsis"><p>The WikiPlot Development Team.</p>
			<div class="authors"><h2 class="title">Authors</h2><span class="author">Jonas F. Jensen.
				<div class="author-blurb"><a href="mailto:wikiplot@jopsen.dk">WikiPlot@Jopsen.dk</a></div></span>
			<span class="author">Ismail Faizi
				<div class="author-blurb"><a href="mailto:kanafghan@gmail.com">KanAfghan@Gmail.com</a></div></span></div></div>
	<span><a name="DeveloperGuide"></a><h2 class="title">Developer Guide</h2><p>PlotClass is the set of classes that enable WikiPlot to create plots from mathematical expressions. This is a small guide to help other developers take advantage of the PlotClass. PlotClass consists of plot.class.php and graph.plot.class.php, and it depends on MathEval.class.php. Here we will focus on how you could use PlotClass to creating plot form mathematical expression in your applications.</p>
		<span><h3 class="title">Class structure</h3><p>In PlotClass the most importent classes are plot and graph. If plot is the paper, then graph are the mathematical expressions to be plotted onto the paper. The class plot contains settings for the output image and the coordinate space the mathematical expressions are to be plotted upon. The class plot also contains an array of graph to be plotted. A graph class represents a mathematical expression, it's label and other settings related to the mathematical expression. You might consider this a somewhat odd terminology, but feel free to contact us if you have a less confusing one.</p></span>
		<span><h3 class="title">Example</h3><p><div class="src-code"><ol><li><div class="src-line"><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><span class="src-comm">/*</span></div></li>
<li><div class="src-line"><span class="src-comm">This&nbsp;is&nbsp;an&nbsp;example&nbsp;of&nbsp;how&nbsp;plot.class.php&nbsp;could&nbsp;be&nbsp;used.&nbsp;In&nbsp;this&nbsp;example&nbsp;we&nbsp;will&nbsp;draw&nbsp;a&nbsp;graph&nbsp;of&nbsp;the&nbsp;mathematical&nbsp;expression&nbsp;sent&nbsp;via.&nbsp;the&nbsp;GET&nbsp;method.</span></div></li>
<li><div class="src-line"><span class="src-comm">*/</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Tell&nbsp;the&nbsp;client&nbsp;that&nbsp;this&nbsp;is&nbsp;a&nbsp;binary&nbsp;png&nbsp;file,&nbsp;NOT&nbsp;html.</span></div></li>
<li><div class="src-line"><span class="src-comm">//This&nbsp;is&nbsp;also&nbsp;why&nbsp;you&nbsp;can't&nbsp;use&nbsp;html&nbsp;in&nbsp;this&nbsp;example.</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><a href="http://www.php.net/header">header</a><span class="src-sym">(</span><span class="src-str">&quot;Content-type:&nbsp;image/png&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">/*</span></div></li>
<li><div class="src-line"><span class="src-comm">Include&nbsp;plot.class.php,&nbsp;since&nbsp;we&nbsp;need&nbsp;the&nbsp;file&nbsp;to&nbsp;draw&nbsp;with.</span></div></li>
<li><div class="src-line"><span class="src-comm">*/</span></div></li>
<li><div class="src-line"><span class="src-inc">include</span><span class="src-sym">(</span><span class="src-str">&quot;plot.class.php&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Create&nbsp;an&nbsp;instance&nbsp;of&nbsp;Plot</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../WikiPlot/PlotClass/Plot.html">Plot</a></span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Initialize&nbsp;some&nbsp;fields&nbsp;on&nbsp;the&nbsp;Plot</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot</span><span class="src-sym">-&gt;</span><span class="src-id">Caption&nbsp;</span>=&nbsp;<span class="src-str">&quot;Example&nbsp;plot&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Setting&nbsp;image&nbsp;size</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot</span><span class="src-sym">-&gt;</span><span class="src-id">Width&nbsp;</span>=&nbsp;<span class="src-num">500</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot</span><span class="src-sym">-&gt;</span><span class="src-id">Height&nbsp;</span>=&nbsp;<span class="src-num">500</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Setting&nbsp;coordinate&nbsp;space</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot</span><span class="src-sym">-&gt;</span><span class="src-id">MinX&nbsp;</span>=&nbsp;-<span class="src-num">250</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot</span><span class="src-sym">-&gt;</span><span class="src-id">MaxX&nbsp;</span>=&nbsp;<span class="src-num">250</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot</span><span class="src-sym">-&gt;</span><span class="src-id">MinY&nbsp;</span>=&nbsp;-<span class="src-num">250</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot</span><span class="src-sym">-&gt;</span><span class="src-id">MaxY&nbsp;</span>=&nbsp;<span class="src-num">250</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Creating&nbsp;an&nbsp;instance&nbsp;of&nbsp;Graph</span></div></li>
<li><div class="src-line"><span class="src-var">$G&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../WikiPlot/PlotClass/Graph.html">Graph</a></span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Set&nbsp;the&nbsp;expression&nbsp;of&nbsp;the&nbsp;graph&nbsp;to&nbsp;the&nbsp;parameter&nbsp;given&nbsp;via&nbsp;the&nbsp;GET&nbsp;method.</span></div></li>
<li><div class="src-line"><span class="src-var">$G</span><span class="src-sym">-&gt;</span><span class="src-id">Exp&nbsp;</span>=&nbsp;<span class="src-var">$_GET</span><span class="src-sym">[</span><span class="src-str">&quot;exp&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Set&nbsp;the&nbsp;color&nbsp;of&nbsp;the&nbsp;Graph</span></div></li>
<li><div class="src-line"><span class="src-var">$G</span><span class="src-sym">-&gt;</span><span class="src-id">Color&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">,</span><span class="src-num">0</span><span class="src-sym">,</span><span class="src-num">255</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Set&nbsp;the&nbsp;label&nbsp;of&nbsp;the&nbsp;Graph</span></div></li>
<li><div class="src-line"><span class="src-var">$G</span><span class="src-sym">-&gt;</span><span class="src-id">Label&nbsp;</span>=&nbsp;<span class="src-str">&quot;GET&nbsp;graph&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Add&nbsp;all&nbsp;(in&nbsp;this&nbsp;case&nbsp;only&nbsp;one)&nbsp;instances&nbsp;of&nbsp;Graph&nbsp;to&nbsp;an&nbsp;array&nbsp;and&nbsp;parse&nbsp;to&nbsp;Plot</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot</span><span class="src-sym">-&gt;</span><span class="src-id">Graphs&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$G</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line"><span class="src-comm">//Display&nbsp;the&nbsp;final&nbsp;Image,&nbsp;printed&nbsp;as&nbsp;binary&nbsp;png&nbsp;in&nbsp;this&nbsp;file.</span></div></li>
<li><div class="src-line"><span class="src-var">$Plot</span><span class="src-sym">-&gt;</span><span class="src-id">DisplayPlot</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span><span class="src-php">?&gt;</span></div></li>
</ol></div></p></span>
		<span><h3 class="title">Support/Help</h3><p>If you have questions or problems/bug, feel free to contact us: <a href="http://groups.google.com/group/wikiplot">Mailinglist</a>.</p></span></span></div>

	<table class="tutorial-nav-box">
	<tr>
		<td style="width: 30%">
							<a href="../WikiPlot/tutorial_AdminGuide.pkg.html" class="nav-button">Previous</a>
					</td>
		<td style="text-align: center">
					</td>
		<td style="text-align: right; width: 30%">
							<a href="../WikiPlot/tutorial_WikiPlot.pkg.html" class="nav-button">Next</a>
					</td>
	</tr>
	<tr>
		<td style="width: 30%">
							<span class="detail">WikiPlot Administrators Guide</span>
					</td>
		<td style="text-align: center">
					</td>
		<td style="text-align: right; width: 30%">
							<span class="detail">WikiPlot Userguide</span>
					</td>
	</tr>
</table>
	
	<p class="notes" id="credit">
		Documentation generated on Fri, 13 Oct 2006 16:12:22 +0200 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0</a>
	</p>
	</div></body>
</html>